<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MdiWin Demo - edit</title>
    <uieip type="file" value="inc" src="/yqwin/easyui/include.txt" cache="true" minute="1440"></uieip>
    <uieip type="file" value="css" src="/yqwin/css/yqwin.min" cache="false"></uieip>
    <uieip type="file" value="js" src="/yqwin/data/yqwin.min" cache="false"></uieip>
</head>

<body>
    <h1>yqComboGrid</h1>
    <select id="cg" style="width: 300px;"></select>
    <p></p>

    <span>isSeek:</span><input id="ck_isEdit" type="checkbox" checked />
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:isEdit(true)">isEdit-true</a>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:isEdit(false)">isEdit-false</a>

    <input id="txt_width" value="280" style="width:160px;">

    <form>
        <table style="width: 100%;">
            <tr>
                <td width="380px">
                    <div class="easyui-panel" title="editMode" style="width:100%;max-width:370px;padding: 5px;">
                        <div id="div_editMode"></div>
                    </div>
                </td>
                <td>
                    <div class="easyui-panel" title="editType" style="width:100%;max-width:370px;padding: 5px;">
                        <div id="div_editType"></div>
                    </div>
                </td>
            </tr>
        </table>
    </form>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:reset()">reset</a>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:destroy()">destroy</a>

    <script>
        $(function () {
            $("#cg").yqComboGrid({
                dbname: null,
                tbname: "foreignkey",
                keyId: "sid", //关键字段
                bindingKeyId: null,
                bindingValue: null,
                pKeyId: null,
                pKeyValue: null,

                editMode: 1,   //1、2、3 弹出编辑模态窗体
                editType: 1,    //editMode=2,3时  1:属性编辑模式  2:form编辑模式
                editModeW: 650, //模态编辑器宽度 格式为 800（数字）
                editModeH: 400, //模态编辑器高度 格式为 600（数字）
                editModeNo: -1, //编辑模板

                loadDefault: false,   //加载默认值
                blankTag: "*",        //值不能为空，标题附加标记

                loadData: true,
                isEdit: true,
                isSeek: true,
                displayMember: "textbox",          //显示字段

                panelWidth: 600,
                panelHeight: 400,

                rownumbers: true,                //显示行号
                isPage: false,                   //分页
                pageNo: 1,
                pageSize: 10,
                pageList: [5, 10, 20, 30, 40, 50],

                isEdit: true, //可编辑
                copy: true,
                add: true,
                upp: true,
                del: true,
                isdel: true, //可注销
                isdelEdit: true, //注销是否可编辑
                move: true, //可移动
                editLinks: [{},
                {
                    id: "download",
                    text: "下载",
                    iconCls: "icon-search",
                    onClick: function () {
                        console.log("home click");
                    }
                }],  //显示的链接菜单
                editMenus: [{},
                {
                    id: "download2",
                    text: "下载",
                    iconCls: "icon-search",
                    onClick: function () {
                        console.log("home click");
                    }
                }],
            });

            $("#txt_width").numberspinner({
                min: 100,
                max: 1000,
                buttonText: "resize",
                onClickButton: function () {
                    $("#cg").yqComboGrid("resize", $(this).numberspinner("getValue"));
                },
            });

            $("#div_editMode").radiogroup({
                name: 'radio1',
                labelWidth: 340,
                data: [{
                    value: '1',
                    label: '弹出编辑模态窗体',
                }],
                value: 1,
                dir: 'v'
            });

            $("#div_editType").radiogroup({
                name: 'radio2',
                labelWidth: 340,
                data: [{
                    value: '1',
                    label: '属性编辑模式 editMode=2,3使用',
                }, {
                    value: '2',
                    label: 'form编辑模式 editMode=2,3使用'
                }],
                value: 1,
                dir: 'v'
            });
        });

        function isEdit(tf) {
            $("#cg").yqComboGrid("options").isSeek = $("#ck_isEdit").is(':checked');
            $("#cg").yqComboGrid("isEdit", tf);
        }


        function reset() {
            $("#cg").yqComboGrid({
                //frozenNum: 2,
                editMode: $("#div_editMode").radiogroup("getValue"),
                editType: $("#div_editType").radiogroup("getValue")
            });
        }

        function destroy() {
            $("#cg").yqComboGrid("destroy");
        }

    </script>
</body>

</html>